﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AppFx.Data.Collections;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

		private void buttonX1_Click(object sender, EventArgs e)
		{
			ObjectView<TestObject> view = new ObjectView<TestObject>(CreateDummyData(100));
			dataGridView1.DataSource = view;
		}

		private TestObject[] CreateDummyData(int amount)
		{
			TestObject[] dummies = new TestObject[amount];
			for (int i = 0; i < amount; i++)
			{
				dummies[i] = new TestObject() 
				{ Title = "Herr", ForeName = "Achim", LastName = "Schnell",
				  Street = "Faberstraße 7", ZipCode = 55278, City = "Mommenheim"
				};
			}
			return dummies;
		}
    }
	public class TestObject
	{
		public string Title { get; set; }
		public string ForeName { get; set; }
		public string LastName { get; set; }
		public string Street { get; set; }
		public int ZipCode { get; set; }
		public string City { get; set; }

		public TestObject()
		{

		}
	}
}
